package com.cn.hotel.servlet.front;
import com.cn.hotel.model.CompanyInformationModel;
import com.cn.hotel.model.NavModel;
import com.cn.hotel.model.ServiceItemsModel;
import com.cn.hotel.service.ICompanyInformationService;
import com.cn.hotel.service.INavService;
import com.cn.hotel.service.IServiceItemsService;
import com.cn.hotel.service.impl.CompanyInformationServiceImpl;
import com.cn.hotel.service.impl.NavServiceImpl;
import com.cn.hotel.service.impl.ServiceItemsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/contact")
public class ContactServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //联系我们内容元素获取
//        IContactService iContactService = new ContactServiceImpl();
//        ContactModel contactModel = iContactService.getContactModelFromIo();
//        req.setAttribute("contactModel",contactModel);
        //左侧服务项目集合元素获取
        IServiceItemsService iServiceItemsService = new ServiceItemsServiceImpl();
        List<ServiceItemsModel> serviceItemsModelList = iServiceItemsService.getServiceItemsModel();
        req.setAttribute("serviceItemsModelList",serviceItemsModelList);
        //导航元素获取
        INavService iNavService = new NavServiceImpl();
        List<NavModel> navModelList = iNavService.getNavModelListFromIo();
        req.setAttribute("navModelList",navModelList);
        //公司信息获取
        ICompanyInformationService iCompanyInformationService = new CompanyInformationServiceImpl();
        CompanyInformationModel companyInformationModel = iCompanyInformationService.getCompanyInformationModel();
        req.setAttribute("companyInformationModel",companyInformationModel);


        req.getRequestDispatcher("/jsp/contact.jsp").forward(req,resp);


    }
}
